We study here an optimal control problem for a semilinear elliptic equation with an exponential nonlinearity, such that we cannot
expect to have a solution of the state equation for any given control. We then have to speak of pairs (control, state). After having
defined a suitable functional class in which we look for solutions, we prove existence of an optimal pair for a large class of cost
functions using a non standard compactness argument. Then, we derive a first order optimality system assuming the optimal pair is
slightly more regular.